package com.peach.stock.controller;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.peach.stock.service.AnalysisService;
import com.peach.stock.service.DataAPIService;

/**
 * 
 * @author robin
 *
 */
@RestController
@ResponseBody
public class ManageController {

	private static final Logger log = LoggerFactory.getLogger(ManageController.class);

	private static final SimpleDateFormat SDF10 = new SimpleDateFormat("yyyy-MM-dd");
	
	@Resource
    private DataAPIService dataAPIService;

	@Resource
    private AnalysisService analysisService;

	@RequestMapping("/gethq")
	public String getHQ(String rq, String hy) {
		if (rq == null || rq.trim().length() == 0)
		{
			
			rq = SDF10.format(new Date());
		}
		dataAPIService.getHQ(rq);
		return " ok!!!:";
	}
	
	@RequestMapping("/getfr")
	public String getFR(String rq) {
		int i = dataAPIService.getFRFrom163(rq);
		return " ok!!!:" + i;
	}
	
}
